
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;


public class sample_reader
{
    public static void main(String[] args)
    {

        File file = new File("parser/googlexml.xml");



        /*  
         *
         *  IMP: FOLLOWING 9 LINES COPIED FROM ANOTHER SOURCE- , 
         *  THIS IS USED TO JUST TEST THE PARSER
         *
         */

        StringBuffer contents = new StringBuffer();
        BufferedReader reader = null;
        try
        {
            reader = new BufferedReader(new FileReader(file));
            String text = null;
            while ((text = reader.readLine()) != null)
            {
                contents.append(text).append(System.getProperty("line.separator"));
            }

            /*  
             *
             *  IMP: COPIED FROM ANOTHER SOURCE- ENDS HERE 
             *
             */





            XmlParser method = new XmlParser();
            HashMap<String, String> hm = new HashMap<String, String>();
            method.googleDocParser(contents.toString(),hm);

            for(int i=0;i<hm.size()/9;i++)
            {
                System.out.println("entry =" + i);
                System.out.println("src_content::" + hm.get("src_content"+i));
                System.out.println("href_editmedia::" + hm.get("href_editmedia"+i));
                System.out.println("href_edit::" + hm.get("href_edit"+i));
                System.out.println("contentof_updated::" + hm.get("contentof_updated"+i));
                System.out.println("contentof_title::" + hm.get("contentof_title"+i));
                System.out.println("contentof_gd:resourceId::" + hm.get("contentof_gd:resourceId"+i));
                System.out.println("contentof_name::" + hm.get("contentof_name"+i));
                System.out.println("contentof_email::" + hm.get("contentof_email"+i));
                System.out.println("gd:etag::" + hm.get("gd:etag"+i));

            }
        }


        catch (FileNotFoundException e)
        {
            e.printStackTrace();
        }

        catch (IOException e)
        {
            e.printStackTrace();
        }
        finally 
        {
            try
            {
                if (reader != null)
                {
                    reader.close();
                }
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }

        }
    }
}








